package NXTExplorer;

import lejos.nxt.LCD;
import Connection.Connector;
import Connection.DataParser;
import data.DataQueue;

public class NXTMapper {

	/**
	 * Main method.
	 * @param args
	 */
	public static void main(String[] args) {
		NXTMapper mapper = new NXTMapper();
		mapper.run();
	}

	/**
	 * Sets up and runs the NXT-Mapper.
	 */
	public void run() {
		LCD.clear();
		System.out.println("NXT-Mapper");
		System.out.println("Waiting...");
		
		 // holds data which need to send to the PC
		DataQueue queue = new DataQueue();

		//Creating Bluetooth connection
		Connector con = new Connector();
		
		LCD.clear();
		System.out.println("Connected");
		
		//Thread for sending data
		DataParser dp = new DataParser(con, queue);
		dp.setSending(true);
		dp.start();
		
//		BTConnection con = Bluetooth.waitForConnection();


//		DataOutputStream out = con.openDataOutputStream();

		// Start ExplorerBot to do the work
		ExplorerBot robot = new ExplorerBot(queue);
		robot.start();
	}

}
